﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ControlAccessUser.Bussiness;

namespace ControlAccessUser.Presenter
{
    public class PresenterReportsOfLogins
    {
        IReportsOfLoginsView View;

        public PresenterReportsOfLogins(IReportsOfLoginsView View)
        {
            this.View = View;
        }

        public void SearchLoginsByUser()
        {
            if (View.FilterType == "SESION")
            {
                View.Logins = ManagerUser.SearchLoginsByUserAndSession(View.User, View.DateTimeInit, View.DateTimeEnd);
            }
            else if(View.FilterType=="SEMANA")
            {
                View.Logins = ManagerUser.SearchLoginsByUserAndWeek(View.User, View.DateTimeInit, View.DateTimeEnd);                
            }
            else if (View.FilterType == "MES")
            {
                View.Logins = ManagerUser.SearchLoginsByUserAndMonth(View.User, View.DateTimeInit, View.DateTimeEnd);
            }
        }

        private decimal? getHoras(DateTime dateTimeInit, DateTime? dateTimeEnd)
        {
            return (dateTimeEnd.Value - dateTimeInit).Hours;
        }
    }
}
